<?php
class WildDrawCard extends BaseCard
{
	function WildDrawCard($color)
	{
		if(!empty($color))
		{
			if(strlen($color) != 1)
			{
				$color = "";
			}
			
			if($color != "r" && $color != "g" && $color != "b" && $color != "y" )
			{
				$color = "";
			}
		}
		
		$this->color = $color;
		$this->type = WildDraw;
		$this->num = 4;
	}

	function equal($state)
	{
		return true;
	}

	function overlay($state)
	{
		$state->punished = false;
		
		$state->type = $this->type;

		if(!empty($this->color))
		{
			$state->color = $this->color;
		}

		if($state->num == 1)
		{
			$state->num = 4;
		}else{
			$state->num += $this->num;
		}
	}
}